using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace Axe.Xml
{
    public sealed class XmlObjLoader<TTargetType> where TTargetType:class
    {
        XmlSerializer m_Serializer = new XmlSerializer(typeof(TTargetType));

        public TTargetType Load(string fileName)
        {
            using (FileStream fs = new FileStream(fileName,FileMode.Open))
            {
                return (TTargetType)m_Serializer.Deserialize(fs);
            }
        }

        public TTargetType Load(Stream s)
        {
            return (TTargetType)m_Serializer.Deserialize(s);
        }
    }
}
